﻿internal static class DefineConstants
{
	public const int ARCH_V_4 = 0; //4
	public const int Null = 0;
	public const int r_sp = 13; //SP寄存器（栈）
	public const int r_lr = 14; //LR寄存器（返回）
	public const int r_pc = 15; //PC寄存器（程序计数器）
	public const int EXEC_SUCCESS = 0; //指令执行成功
	public const int EXEC_IGNORE = 1; //指令被忽略（条件不允许执行）
	public const int EXEC_UNPREDICTABLE = 2; //不可预料
	public const int EXEC_NOT_IMPL = 3; //指令未实现
	public const int EXEC_ERROR = -1; //执行失败
	public const int MRP_MAX_INNEER_NAME_LEN = 128; //mrp内部文件名称最大长度
	public const int MRP_MAX_INNEER_FILE = 512; //mrp内部文件最大数量
	public const int MAX_FILE_PATH_LEN = 256; //最大文件路径长度
	public const uint MR_SUCCESS = 0; //成功
									  //public const int MR_FAILED = -1; //失败
	public const uint MR_SWITCHPATH = 1204;
	public const uint MR_CHECK_TOUCH = 1205;
	public const uint MR_GET_HANDSET_LG = 1206;
	public const uint MR_CHINESE = 1001;
	public const uint MR_MSDC_OK = 1000;
	public const int Cycle = 10000;
    public static uint MR_FAILED
    {
        get
        {
            UnityEngine.Debug.LogWarning("MR_FAILED");
            return uint.MaxValue;
        }
    }//失败

    public static uint MR_MAX_FILE_SIZE = 1024000;

    public const uint MR_IGNORE = 1; //不关心
	public const int MR_WAITING = 2; //异步(非阻塞)模式
	public const int MR_FILE_MAX_LEN = 128; //mrp文件名及mrp内部文件名的最大长度
	public const int MRST_MAX_0FILES = 50; //注册固化应用的最大数量
	public const int MRST_INTERNAL_TABLE_MAX = 16; //c_internal_table的最大长度
	public const int MRST_CPORT_TABLE_MAX = 4; //c_port_table的最大长度
	public const int BITMAPMAX = 30;
	public const int SPRITEMAX = 10;
	public const int TILEMAX = 3;
	public const int SOUNDMAX = 5;
	public const int VM_MEM_OFFSET = 0x10; //内存装载偏移量
    public const int VM_MAX_PIXELS = 480 * 800; //最大分辨率  000
    public const int VM_STACK_SIZE = 1024 * 20; //栈大小  
                                                //public const int VM_STACK_SIZE = 1024 * 20*3; //栈大小  
                                                //public const int VM_MAX_PIXELS =1; //最大分辨率
                                                //public const int VM_STACK_SIZE = 1; //栈大小
    public const int MAX_WBITS = 15; /* 32K LZ77 window */
	public const int Z_NO_FLUSH = 0;
	public const int Z_PARTIAL_FLUSH = 1;
    public const int Z_SYNC_FLUSH = 2;
    public const int Z_FULL_FLUSH = 3;
	public const int Z_FINISH = 4;
    public const int Z_BLOCK = 5;
    public const int Z_TREES = 6;

	public const int Z_OK = 0;
	public const int Z_STREAM_END = 1;
	public const int VM_POINTERS_MAX = 5; //虚拟机特殊指针个数
	public const int SWI_MR_MALLOC = 0x1001;
	public const int SWI_MR_FREE = 0x1002;
	public const int SWI_MR_REALLOC = 0x1003;
	public const int SWI_MR_MEMCPY = 0x1011;
	public const int SWI_MR_MEMMOVE = 0x1012;
	public const int SWI_MR_STRCPY = 0x1013;
	public const int SWI_MR_STRNCPY = 0x1014;
	public const int SWI_MR_STRCAT = 0x1015;
	public const int SWI_MR_STRNCAT = 0x1016;
	public const int SWI_MR_MEMCMP = 0x1017;
	public const int SWI_MR_STRCMP = 0x1018;
	public const int SWI_MR_STRNCMP = 0x1019;
	public const int SWI_MR_STRCOLL = 0x101a;
	public const int SWI_MR_MEMCHR = 0x101b;
	public const int SWI_MR_MEMSET = 0x101c;
	public const int SWI_MR_STRLEN = 0x101d;
	public const int SWI_MR_STRSTR = 0x101e;
	public const int SWI_MR_SPRINTF = 0x101f;
	public const int SWI_MR_ATOI = 0x1020;
	public const int SWI_MR_STRTOUL = 0x1021;
	public const int SWI_MR_RAND = 0x1022;
	public const int SWI_MR_STOP_EX = 0x1030;
	public const int SWI_MR_C_FUNCTION_NEW = 0x1031;
	public const int SWI_MR_PRINTF = 0x1041;
	public const int SWI_MR_MEM_GET = 0x1042;
	public const int SWI_MR_MEM_FREE = 0x1043;
	public const int SWI_MR_REFRESHBUFFER = 0x1044;
	public const int SWI_MR_GETCHARBITMAP = 0x1045;
	public const int SWI_MR_TIMERSTART = 0x1046;
	public const int SWI_MR_TIMERSTOP = 0x1047;
	public const int SWI_MR_GETTIME = 0x1048;
	public const int SWI_MR_GETDATETIME = 0x1049;
	public const int SWI_MR_GETUSERINFO = 0x104a;
	public const int SWI_MR_SLEEP = 0x104b;
	public const int SWI_MR_PLAT = 0x1051;
	public const int SWI_MR_PLATEX = 0x1052;
	public const int SWI_MR_FERRNO = 0x1061;
	public const int SWI_MR_OPEN = 0x1062;
	public const int SWI_MR_CLOSE = 0x1063;
	public const int SWI_MR_INFO = 0x1064;
	public const int SWI_MR_WRITE = 0x1065;
	public const int SWI_MR_READ = 0x1066;
	public const int SWI_MR_SEEK = 0x1067;
	public const int SWI_MR_GETLEN = 0x1068;
	public const int SWI_MR_REMOVE = 0x1069;
	public const int SWI_MR_RENAME = 0x106a;
	public const int SWI_MR_MKDIR = 0x106b;
	public const int SWI_MR_RMDIR = 0x106c;
	public const int SWI_MR_FINDSTART = 0x106d;
	public const int SWI_MR_FINDGETNEXT = 0x106e;
	public const int SWI_MR_FINDSTOP = 0x106f;
	public const int SWI_MR_EXIT = 0x1081;
	public const int SWI_MR_STARTSHAKE = 0x1082;
	public const int SWI_MR_STOPSHAKE = 0x1083;
	public const int SWI_MR_PLAYSOUND = 0x1084;
	public const int SWI_MR_STOPSOUND = 0x1085;
	public const int SWI_MR_SENDSMS = 0x1091;
	public const int SWI_MR_CALL = 0x1092;
	public const int SWI_MR_GETNETWORKID = 0x1093;
	public const int SWI_MR_CONNECTWAP = 0x1094;
	public const int SWI_MR_MENUCREATE = 0x10a1;
	public const int SWI_MR_MENUSETITEM = 0x10a2;
	public const int SWI_MR_MENUSHOW = 0x10a3;
	public const int SWI_MR_MENUSETFOCUS = 0x10a4;
	public const int SWI_MR_MENURELEASE = 0x10a5;
	public const int SWI_MR_MENUREFRESH = 0x10a6;
	public const int SWI_MR_DIALOGCREATE = 0x10a9;
	public const int SWI_MR_DIALOGRELEASE = 0x10aa;
	public const int SWI_MR_DIALOGREFRESH = 0x10ab;
	public const int SWI_MR_TEXTCREATE = 0x10ae;
	public const int SWI_MR_TEXTRELEASE = 0x10af;
	public const int SWI_MR_TEXTREFRESH = 0x10b1;
	public const int SWI_MR_EDITCREATE = 0x10b4;
	public const int SWI_MR_EDITRELEASE = 0x10b5;
	public const int SWI_MR_EDITGETTEXT = 0x10b6;
	public const int SWI_MR_WINCREATE = 0x10b9;
	public const int SWI_MR_WINRELEASE = 0x10ba;
	public const int SWI_MR_GETSCREENINFO = 0x10bd;
	public const int SWI_MR_INITNETWORK = 0x10c1;
	public const int SWI_MR_CLOSENETWORK = 0x10c2;
	public const int SWI_MR_GETHOSTBYNAME = 0x10c3;
	public const int SWI_MR_SOCKET = 0x10c4;
	public const int SWI_MR_CONNECT = 0x10c5;
	public const int SWI_MR_CLOSESOCKET = 0x10c6;
	public const int SWI_MR_RECV = 0x10c7;
	public const int SWI_MR_RECVFROM = 0x10c8;
	public const int SWI_MR_SEND = 0x10c9;
	public const int SWI_MR_SENDTO = 0x10ca;
	public const int SWI_MR_MD5_INIT = 0x10d1;
	public const int SWI_MR_MD5_APPEND = 0x10d2;
	public const int SWI_MR_MD5_FINISH = 0x10d3;
	public const int SWI_MR_LOAD_SMS_CFG = 0x10d7;
	public const int SWI_MR_SAVE_SMS_CFG = 0x10d8;
	public const int SWI_MR_DISPUPEX = 0x10e1;
	public const int SWI_MR_DRAWPOINT = 0x10e2;
	public const int SWI_MR_DRAWBITMAP = 0x10e3;
	public const int SWI_MR_DRAWBITMAPEX = 0x10e4;
	public const int SWI_MR_DRAWRECT = 0x10e5;
	public const int SWI_MR_DRAWTEXT = 0x10e6;
	public const int SWI_MR_BITMAPCHECK = 0x10e7;
	public const int SWI_MR_READFILE = 0x10f1;
	public const int SWI_MR_WSTRLEN = 0x10f2;
	public const int SWI_MR_REGISTERAPP = 0x10f3;
	public const int SWI_MR_DRAWTEXTEX = 0x10f4;
	public const int SWI_MR_EFFSETCON = 0x10f5;
	public const int SWI_MR_TESTCOM = 0x10f6;
	public const int SWI_MR_TESTCOM1 = 0x10f7;
	public const int SWI_MR_C2U = 0x10f8;
	public const int SWI_MR_DIV = 0x10f9;
	public const int SWI_MR_MOD = 0x10fa;

	//public const int SWI_MR_UPDCRC = 0x110;
	//public const int SWI_MR_UNZIP = 0x110;
	//public const int SWI_MR_PLATDRAWCHAR = 0x110;
	//public const int SWI_MR_TRANSBITMAPDRAW = 0x110;
	//public const int SWI_MR_DRAWREGION = 0x110;

    public const int SWI_MR_UPDCRC = 0x10fd;
    public const int SWI_MR_UNZIP = 0x1101;
    public const int SWI_MR_PLATDRAWCHAR = 0x1105;
    public const int SWI_MR_TRANSBITMAPDRAW = 0x110;
    public const int SWI_MR_DRAWREGION = 0x110;

    public const int DATAP_RESERVE = 0;
	public const int DATAP_C_INTERNAL_TABLE = -1;
	public const int DATAP_C_PORT_TABLE = -2;
	public const int DATAP_LG_MEM_MIN = -3;
	public const int DATAP_LG_MEM_TOP = -4;
	public const int DATAP_START_FILE_PARAMETER = -5;
	public const int DATAP_SMS_RETURN_FLAG = -6;
	public const int DATAP_SMS_RETURN_VAL = -7;
	public const int DATAP_EXIT_CB = -8;
	public const int DATAP_EXIT_CB_DATA = -9;
	public const int DATAP_ENTRY = -10;
	public const int DATAP_LG_MEM_FREE = -11;
	public const int DATAP_SCREENBUF = -12;
	public const int DATAP_SCREENWIDTH = -13;
	public const int DATAP_SCREENHEIGHT = -14;
	public const int DATAP_SCREENBIT = -15;
	public const int DATAP_BITMAP = -16;
	public const int DATAP_TILE = -17;
	public const int DATAP_MAP = -18;
	public const int DATAP_SOUND = -19;
	public const int DATAP_SPRITE = -20;
	public const int DATAP_PACK_FILENAME = -21;
	public const int DATAP_START_FILENAME = -22;
	public const int DATAP_OLD_PACK_FILENAME = -23;
	public const int DATAP_OLD_START_FILENAME = -24;
	public const int DATAP_RAM_FILE = -25;
	public const int DATAP_RAM_FILE_LEN = -26;
	public const int DATAP_SOUNDON = -27;
	public const int DATAP_SHAKEON = -28;
	public const int DATAP_LG_MEM_BASE = -29;
	public const int DATAP_LG_MEM_LEN = -30;
	public const int DATAP_LG_MEM_END = -31;
	public const int DATAP_LG_MEM_LEFT = -32;
	public const int DATAP_SMS_CFG_BUF = -33;
	public const int FMT_STACK_SIZE = 128;
	public const int MR_TILE_SHIFT = 11;
	public const int MR_ROTATE_0 = 0;
	public const int MR_ROTATE_90 = 1;
	public const int MR_ROTATE_180 = 2;
	public const int MR_ROTATE_270 = 3;
	public const int MR_FILE_RDONLY = 1; //以只读的方式打开文件。
	public const int MR_FILE_WRONLY = 2; //以只写的方式打开文件。
	public const int MR_FILE_RDWR = 4; //以读写的方式打开文件。
	public const int MR_FILE_CREATE = 8; //如果文件不存在，创建该文件。
	public const int MR_FILE_RECREATE = 16; //无论文件存不存在，都重新创建该文件。
	public const int MR_IS_FILE = 1; //文件
	public const int MR_IS_DIR = 2; //目录
	public const int MR_IS_INVALID = 8; //无效(非文件、非目录)
	public const string DEV_OUTPUT_DIR = "devout/";
	public const int SHT_NULL = 0; //无效段
	public const int SHT_PROGBITS = 1; //程序段、代码段、数据段都是此种类型
	public const int SHT_SYMTAB = 2; //表示该段的类内容为符号表
	public const int SHT_STRTAB = 3; //表示该段的内容是字符串表
	public const int SHT_RELA = 4; //重定位表，该段包含了重定位信息
	public const int SHT_HASH = 5; //符号表的哈希表
	public const int SHT_DYNAMIC = 6; //动态链接信息
	public const int SHT_NOTE = 7; //提示性信息
	public const int SHT_NOBITS = 8; //表示该段在文件中没有内容，比如.bss段
	public const int SHT_REL = 9; //该段包含了重定位信息
	public const int SHT_SHLIB = 10; //该段保留
	public const int SHT_DNYSYM = 11; //动态链接的符号表
	public const int SHF_WRITE = 1; //表示该段在进程空间中可写
	public const int SHF_ALLOC = 2; //表示该段需要在进程空间中分配空间
	public const int SHF_EXECINSTR = 4; //表示该段在进程空间中可以被执行
	public const int GZIP_BUFFER_SIZE = 1024 * 1024;
	public const string START_MRP_FILE_NAME = "hello.mrp";
	public const string START_FILE_NAME = "cfunction.ext";
	public const string START_EXT = "cfunction.ext";
	public const string logo_EXT = "logo.ext";
    public const string game_EXT = "game.ext";
    public const string dsm_gm_Mrp = "dsm_gm.mrp";
	public const uint MR_READ_MAX_LEN = 1024 * 400; //读取mrp时分配的最大内存空间，额，800k足够用了吧
	public const uint PRINTF_NTOA_BUFFER_SIZE = 32;
	public const uint PRINTF_FTOA_BUFFER_SIZE = 32;
	public const uint PRINTF_DEFAULT_FLOAT_PRECISION = 6;
	public const double PRINTF_MAX_FLOAT = 1e9;
	public const int ALLOC_SIZE = 20;
    internal static readonly int MR_FLAGS_AI=2;
    internal static readonly uint MR_MAX_FILENAME_SIZE=128;
    internal static readonly uint MR_TOUCH_SCREEN=1001;
	public static string RootPath =UnityEngine.Application.platform==UnityEngine.RuntimePlatform.Android? "/storage/emulated/0/Mrp": UnityEngine.Application.streamingAssetsPath;
    //public static uint MEM_MIN_PIECE_SIZE = 16;
    public static uint MEM_MIN_PIECE_SIZE =8;
}